expect
( service in module ngMock
)
Creates a new request expectation.
method – {string} –
HTTP method.
url – {string|RegExp} –
HTTP url.
data(optional) – {(string|RegExp)=} –
HTTP request body.
headers(optional) – {(Object|function(Object))=} –
HTTP headers or function that receives http header object and returns true if the headers match the current expectation.
{requestHandler}
– Returns an object with respond
method that control how a matched
request is handled.
{function([status,] data[, headers])|function(function(method, url, data, headers)}
– The respond method takes a set of static data to be returned or a function that can return
an array containing response status (number), response data (string) and response headers
(Object).